<template>
  <div class="sameCity">
      <!-- 标题 -->
    <div class="sameCityTitle">
      <h1>快手同城</h1>
      <div class="sameText">
        <span>更多</span>
        <ArrowRight style="width: 1em; height: 1em; margin-right: 8px" />
      </div>
    </div>
    <!-- 内容 -->
    <div class="sameCityContext">
      <div class="sameCityItem" v-for="item in firstMvList" :key="item.id">
        <div class="sameCityImg">
          <img
            :src="item.cover"
            alt=""
          />
        </div>
        <div class="sameCityText">
          <h5>
            {{item.name}}
          </h5>
          <div class="sameCityInfo">
            <DeleteLocation style="width: 1em; height: 1em; margin-right: 8px" />
            <span>>30km</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";

export default defineComponent({
  name: "SameCity",
});
</script>

<script lang="ts" setup>
import { ArrowRight, DeleteLocation } from "@element-plus/icons";
import { getFirstMvApi } from "@/api/home";

// 最新Mv列表
const firstMvList = ref([])

onMounted( async () => {
  const res = await getFirstMvApi(10)
  // console.log(res);
  firstMvList.value = res.data.slice(0, 6)
})

</script>

<style lang="less" scoped>
.sameCity {
  margin: 0 auto;
  width: 1126px;
  overflow: hidden;
}
// 标题
.sameCityTitle {
  height: 42px;
  line-height: 42px;
  display: flex;
  margin-bottom: 24px;
  h1 {
    margin: 0;
    margin-right: 24px;
  }
  .sameText {
    display: flex;
    align-items: center;
  }
}
.sameCityContext{
    display: flex;
}
.sameCityItem {
  width: 173px;
  margin-right: 16px;
  margin-bottom: 46px;
  .sameCityImg {
    width: 173px;
    height: 263.5px;
    font-size: 0;
    img {
      border-radius: 5px;
      width: 100%;
      height: 100%;
    }
  }
  .sameCityText {
    padding-top: 16px;
    h5 {
      margin: 0;
      width: 159.5px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      font-size: 15px;
    }
    .sameCityInfo {
      display: flex;
      margin-top: 5px;
      color: #999;
      span{
          font-size: 13px;
      }
    }
  }
}
</style>
